/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.vijay.mvnbuilddownload;

import org.w3c.dom.Document;
//import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 *
 * @author elangovanv
 */
public class MetadataParser {
    private NodeList nodeList;
    private Document documents;

    private  Metadata metadata;

    protected static MetadataParser parser;

    private MetadataParser(Document document) {
        this.documents = document;
        nodeList = documents.getDocumentElement().getChildNodes();
    }

    public static MetadataParser getMetadataParser(Document document) {
        //if (parser == null) {
            parser = new MetadataParser(document);
        //}
        return parser;
    }


    public Metadata parse() {        
        metadata=new Metadata(nodeList);
        metadata.parse();
        //System.out.println("metadata "+metadata.toString());
        return metadata;
    }

    public String toString() {
        return "MetadataParser{" + "metadata=" + metadata + '}';
    }
}
